import fetch from 'utils/fetch';

//新增公司
export function handleFirm(data) {
  return fetch({
	url:  '/api/admin/viceFirm/insertViceFirm',
    method: 'post',
    headers: {'Content-type': 'application/json;charset=UTF-8'},
    data
  });
}

//查询公司列表 
export function firmAll(data) {
  return fetch({
	url:  '/api/admin/firm/selectFirmList',
    method: 'post',
    headers: {'Content-type': 'application/json;charset=UTF-8'},
    data
  });
}

//查询公司详情
export function queryFirmDel(firmId) {
  return fetch({
	url:  '/api/admin/firm/findOneById/' + firmId,
    method: 'get',
    headers: {'Content-type': 'application/json;charset=UTF-8'},
  });
}

//查询公司审核列表
export function firmAuditAll(data) {
  return fetch({
	url:  '/api/admin/viceFirm/selectViceFirmList',
    method: 'post',
    headers: {'Content-type': 'application/json;charset=UTF-8'},
    data
  });
}

//查询公司审核详情
export function firmAuditDel(firmId,remarks) {
  return fetch({
	url:  '/api/admin/viceFirm/findApproveFirm/'+firmId+'/'+remarks,
    method: 'get',
    headers: {'Content-type': 'application/json;charset=UTF-8'},
  });
}

//审核公司
export function auditFirm(data) {
    return fetch({
        url:  '/api/admin/viceFirm/updateViceFirm',
        method: 'post',
        headers: {'Content-type': 'application/json;charset=UTF-8'},
        data
    });
}

  //查询公司名称是否重复
export function checkFirmName(data) {
    return fetch({
      url:  '/api/admin/firm/checkFirmName',
      method: 'post',
      headers: {'Content-type': 'application/json;charset=UTF-8'},
      data
    });
}

  //查询公司座机是否重复
  export function checkPhoneForFirm(data) {
    return fetch({
      url:  '/api/admin/firm/checkPhoneForFirm',
      method: 'post',
      headers: {'Content-type': 'application/json;charset=UTF-8'},
      data
    });
}

  //商户进件选择上级公司
  export function findSuperiorFirm(distributorId) {
    return fetch({
      url:  '/api/admin/firm/findFirmByDistributorId/' + distributorId,
      method: 'get',
      headers: {'Content-type': 'application/json;charset=UTF-8'},
    });
}

  //启用停用公司
  export function enableOrDisable_firm(state,firmId) {
    return fetch({
      url:  '/api/admin/firm/startOrStopFirm/'+ state + '/'+ firmId,
      method: 'get',
      headers: {'Content-type': 'application/json;charset=UTF-8'},
    });
}


//重新进件公司
export function reauditViceFirm(data) {
  return fetch({
    url:  '/api/admin/viceFirm/reauditViceFirm',
    method: 'post',
    headers: {'Content-type': 'application/json;charset=UTF-8'},
    data
  });
}